<?php
/**
 * Created by PhpStorm.
 * UsersF: Mloong
 * Date: 2018/12/25
 * Time: 10:30
 */

namespace app\http\middleware;


use think\facade\Request;

class UnsetNull
{
    public function handle($request,\Closure $next)
    {
        $postData = Request::post();
        foreach ($postData as $key => $value){
            if($value == null){
                unset($postData[$key]);
            }
        }
        $request->postData  = $postData;
        return $next($request);
    }
}